class_name UIBlackFade
extends Control

@onready var color_rect: ColorRect = $ColorRect


func fade_in(fade_time: float = 1.0)  -> Tween:
	var tween_alpha = create_tween()
	tween_alpha.tween_property(color_rect, "modulate:a", 1.0, fade_time) \
	.set_trans(Tween.TRANS_CUBIC) \
	.set_ease(Tween.EASE_IN_OUT).from_current()
	return tween_alpha
	

func fade_out(fade_time: float = 1.0) -> Tween:
	var tween_alpha = create_tween()
	tween_alpha.tween_property(color_rect, "modulate:a", 0.0, fade_time) \
	.set_trans(Tween.TRANS_CUBIC) \
	.set_ease(Tween.EASE_IN_OUT).from_current()
	return tween_alpha
